<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <title>Document</title>
    <script src="https://cdn.staticfile.org/vue/2.4.2/vue.min.js"></script>
    <style>
   .fade-enter-active
   .fade-leave-active{
       transition:all 2s;
   }
   .fade-enter
   .fade-leave
   {
       opacity: 0;
     
   }
 
    </style>
</head>

<body>
    <div id="app" mode="in-out">
    <transition name='fade'>
       <button v-if="status==='off'" @click="status='on'" >on</button>   <!--  key="on" -->
       <button v-else @click="status='off'">off</button>  <!-- key="off" -->
    </transition>
    </div>
    <script>
        var vm=new Vue({
           el:'#app',
           data:{
               status:'on'
           },
           methods:{}
        });
    </script>
</body>

</html>